package com.opo5.logisticsmanagement.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.io.BufferedReader;
import java.io.IOException;

/**
 * 流转Json
 */
public class streamToJson {
    public static JSONObject toJson(BufferedReader reader) throws IOException {
        StringBuilder sb = new StringBuilder();
        char[] buff = new char[1024];
        int len;
        while ((len = reader.read(buff)) != -1) {
            sb.append(buff, 0, len);
        }
        return JSON.parseObject(sb.toString());
    }
}
